package scottb.flex;

public enum HAlign {

    LEFT("left"), CENTER("center"), RIGHT("right");

    private final String align;

    HAlign(final String align) {

        this.align = align;
    }

    public String align() {
        return align;
    }

    public String getAlign() {
        return align;
    }

    public String toString() {
        return align;
    }

    public static HAlign lookup(final String align) {

        if(align == null)
            return null;
        else if(align.length() == 0)
            return null;
        else if(align.equalsIgnoreCase(LEFT.align))
            return LEFT;
        else if(align.equalsIgnoreCase(CENTER.align))
            return CENTER;
        else if(align.equalsIgnoreCase(RIGHT.align))
            return RIGHT;

        throw new IllegalArgumentException(align);
    }
}
